package com.itheima.resources.timer;

import java.util.Timer;
import java.util.TimerTask;

public class MyTimer {


    public static void main(String[] args) {

        //  jdk    Timer  TimerTask

        Timer timer = new Timer();//  计时器对象

        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("每隔一段时间执行一次");
            }
        },5000,2000);


    }
}
